package com.kaifamiao.config;

import org.springframework.context.annotation.*;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.transaction.annotation.EnableTransactionManagement;

import javax.sql.DataSource;

/**
 * @author lucien-ma
 * @date 2021/8/31
 * @apiNote
 */
@Configuration
@ComponentScan({"com.kaifamiao"})
@PropertySource("classpath:db.properties")
@Import(JdbcConfig.class)
@EnableTransactionManagement
public class SpringConfig {

    @Bean("transactionManager")
    public DataSourceTransactionManager getDataSourceTransactionManager(DataSource dataSource) {
        return new DataSourceTransactionManager(dataSource);
    }
}
